<template>
  <div>
    <el-form-item
      v-if="activeData.config.fileSize !== undefined"
      :label="$t('formgen.upload.fileSize')"
    >
      <el-input
        v-model.number="activeData.config.fileSize"
        :placeholder="$t('formgen.upload.fileSize')"
      >
        <template #append>
          <el-select
            v-model="activeData.config.sizeUnit"
            :style="{ width: '66px' }"
          >
            <el-option
              label="KB"
              value="KB"
            />
            <el-option
              label="MB"
              value="MB"
            />
            <el-option
              label="GB"
              value="GB"
            />
          </el-select>
        </template>
      </el-input>
    </el-form-item>
    <el-form-item :label="$t('formgen.upload.multiFile')">
      <el-switch v-model="activeData.multiple" />
    </el-form-item>
    <el-form-item :label="$t('formgen.upload.maxFile')">
      <el-input-number v-model="activeData.limit" />
    </el-form-item>
    <el-form-item :label="$t('formgen.upload.openConversion')">
      <el-tooltip
        class="item"
        :content="$t('formgen.upload.conversionDesc')"
        effect="dark"
        placement="top-start"
      >
        <el-icon><ele-QuestionFilled /></el-icon>
      </el-tooltip>
      <el-switch v-model="activeData.openConversion" />
    </el-form-item>
    <el-form-item :label="$t('formgen.upload.imgQuality')">
      <el-tooltip
        class="item"
        :content="$t('formgen.upload.imgQualityDesc')"
        effect="dark"
        placement="top-start"
      >
        <el-icon><ele-QuestionFilled /></el-icon>
      </el-tooltip>
      <el-input-number
        v-model="activeData.conversionRatio"
        :min="0"
        :max="1"
        :step="0.1"
      />
    </el-form-item>
  </div>
</template>

<script>
export default {
  name: "ConfigItemImageUpload",
  props: ["activeData"]
};
</script>
